package Thread;

/**
 * 线程优先级
 * 线程有10个优先级，使用整数1-10表示
 * 其中1表示最小优先级，10为最高优先级，5为默认值
 * 当一个线程调用start方法后就纳入到了操作系统的线程调度器中
 *
 */
public class PriorityDemo {
    public static void main(String[] args) {
        Thread min = new MyThread1() {
            public void run() {
                for (int i = 0; i < 1000; i++) {
                    System.out.println("min");
                }
            }
        };
        Thread max = new MyThread1() {
            public void run() {
                for (int i = 0; i < 1000; i++) {
                    System.out.println("max");
                }
            }
        };
        Thread norm = new MyThread1() {
            public void run() {
                for (int i = 0; i < 1000; i++) {
                    System.out.println("nor");
                }
            }
        };
        min.setPriority(Thread.MIN_PRIORITY);
        max.setPriority(Thread.MAX_PRIORITY);
        min.start();
        norm.start();
        max.start();
    }

}